import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;

/**
 * Created by ospip on 2018/10/31.
 * Copyright (c) 2018 LLAP. All rights reserved.
 */
public class MoonWatcher extends JFrame {
    private Moon moon;

    public MoonWatcher(String title) {
        super(title);
        try {
            UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception e) {
            try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (Exception exc) {
                System.out.println("Substance Raven Graphite failed to initialize");
            }
        }

        this.setSize(400, 150);
//        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        JPanel panel = new JPanel(new GridLayout(1, 1, 15, 0));
        panel.setBorder(new EmptyBorder(10, 10, 10, 10));

        moon = Moon.getInstance();
        JLabel label = new JLabel(moon.toString());
        panel.add(label);
        this.add(panel);
    }

    public MoonWatcher() {
        this("");
    }

    public static void main(String[] args) {
        new MoonWatcher("1").setVisible(true);
        new MoonWatcher("2").setVisible(true);
    }
}
